<%@ page language="java" pageEncoding="UTF-8"
	contentType="text/html;charset=UTF-8"%>
<% 
String basePath = request.getContextPath()+"/"; 
%>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--360浏览器优先以webkit内核解析-->
<title>- 主页示例</title>
<style type="text/css">
<!--
去除边框样式 -->.bootstrap-table>.fixed-table-container>.fixed-table-body>.table>tbody>tr>td
	{
	border: 0px;
}
</style>
<link rel="shortcut icon" href="favicon.ico">
<link href="<%=basePath%>static/css/bootstrap.min.css" rel="stylesheet">
<!-- 全局js -->
<script src="<%=basePath%>static/js/jquery.min.js?v=2.1.4"></script>
<script src="<%=basePath%>static/js/bootstrap.min.js?v=3.3.6"></script>
<!-- <script src="<%=basePath%>static/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="<%=basePath%>static/js/plugins/slimscroll/jquery.slimscroll.min.js"></script> -->
<!-- 自定义js -->
<script src="<%=basePath%>static/js/hAdmin.js?v=4.1.0"></script>
<script type="text/javascript" src="<%=basePath%>static/js/index.js"></script>
<script src="<%=basePath%>static/js/plugins/layer/layer.min.js"></script>
<link href="<%=basePath%>static/css/font-awesome.css?v=4.4.0"
	rel="stylesheet">
<link href="<%=basePath%>static/css/animate.css" rel="stylesheet">
<link href="<%=basePath%>static/css/style.css?v=4.1.0" rel="stylesheet">
<link
	href="<%=basePath%>static/css/plugins/bootstrap-table/bootstrap-table.min.css"
	rel="stylesheet" />
<script src="<%=basePath%>static/js/plugins/layer/layer.min.js"></script>
<link
	href="<%=basePath%>static/css/bootstrap-table-sticky-header.css"
	rel="stylesheet" />
<script
	src="<%=basePath%>static/js/plugins/bootstrap-table/bootstrap-table-all.js"></script>
<script
	src="<%=basePath%>static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script
	src="<%=basePath%>static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script
	src="<%=basePath%>static/js/plugins/bootstrap-table/closable-tab.js"></script>
<!-- validate -->
<script
	src="<%=basePath%>static/jquery-validation/1.11.1/jquery.validate.js"></script>
<script
	src="<%=basePath%>static/jquery-validation/1.11.1/jquery.validate.method.js"></script>
<!-- jquery form  -->
<script src="<%=basePath%>static/js/form.js"></script>
<script src="<%=basePath%>static/js/jquery.form.js"></script>
<!-- 序列化表单  -->
<script src="<%=basePath%>static/js/formSerializeJson.js"></script>
<link
	href="<%=basePath%>static/css/bootstrap-table-sticky-header.css"
	rel="stylesheet" />
<script src="<%=basePath%>static/js/bootstrap-table-sticky-header.js"></script>
<style type="text/css">
.btn {
	width: 100px;
	height: 28px;
	font-size: 11px;
}

body {
	font-size: 11px;
}
</style>
</head>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight"
		style="padding-bottom: 0px">
		<div class="row">
			<div class="col-sm-12" id="renwu">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form id="search-form" role="form" class="form-inline">
							<div class="form-group col-sm-3 col-md-3">
								<label>字段名称:</label> <input type="text" class="form-control"
									style="height: 25px; width: 180px" name="stdMetaName" id="stdMetaName">
							</div>
							<div class="form-group col-sm-3 col-md-3">
								<label>字段中文名称:</label> <input type="text" class="form-control"
									style="height: 25px; width: 180px" name="stdMetaChnName" id="stdMetaChnName">
							</div>
							<div class="form-group col-sm-3 col-md-3">
								<button class="btn btn-info" type="button" id="ok">查询</button>
								&nbsp;&nbsp;
								<button class="btn btn-info" id="empty" type="button">清空</button>
							</div>
						</form>
						<br> <br>
						<div class="row row-lg">
							<div class="col-sm-12 col-md-12 col-lg-12">
								<!-- Example Events -->
								<div class="example-wrap">
									<div class="example bootstrap-table" id="list-page">
										<table id="table" style="font-size: 11px;">
										</table>
									</div>
								</div>
								<!-- End Example Events -->
							</div>
						</div>


						<!-- 工具栏 -->
						<div id="toolbar">
							<form  style="display: none;" id="importCategory" method="post" enctype="multipart/form-data">
									   <input class="hidden" type="file" name="file" id="file" value="" accept=".xls,.xlsx" />
							</form>
							<button type="button" class="btn btn-info btn-sm" id="export">
								<i class="middle-120"></i>导出
							</button>
							<button type="button" class="btn btn-info btn-sm"
								id="downloadTemplete">
								<i class="middle-120"></i>下载Excel模版
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>



	<script>
	$(function(){
		var $table = $('#table');
		    $table.bootstrapTable({
	    	iconSize:'sm',
	    	url:"<%=basePath%>rest/codemanager/metastand/list",
			toolbar:'#toolbar',
			cache: false,
			height:200,
			stickyHeader: true,
			singleSelect:false,
			clickToSelect:false,
			striped : true,
			pagination : true, 
			pageNumber : 1,//首页页码
			pageSize : 10,//页面显示条数
			pageList : [10, 25, 50, 100 ],
			sidePagination : 'server',//服务器端分页
			showExport: true,
			columns : [
			    {checkbox : true}, 
			 	{field:"stdMetaName",title : "字段名称",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"stdMetaChnName",title : "字段中文名称",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"stdMetaType",title:"字段类型",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"stdMetaLength",title:"字段长度",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"stdMetaPrecision",title:"字段精度",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"validFlag",title:"有效标识",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}},formatter:function(value,row,index){
					var value="";
					if(row.validFlag == "0"){
						value="否";
					}else{
						value="是";
					}
					return value;
				}},
				{field:"createTime",title:"创建时间",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"modefyTime",title:"修改时间",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"creatorName",title:"创建人",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				{field:"maintainerName",title:"维护人",cellStyle:function(value, row, index, field){return {css: {"border": "0px"}}}},
				],
				contentType : "application/x-www-form-urlencoded",
				queryParamsType : "limit",
				dataType : "json",
				method : "post",
				queryParams : function(params){
					return params;
				}
		});
		
		
		$.each($('table'),function(i, table){
			if($(table).attr('id') != undefined){
				try {
					$(table).bootstrapTable('resetView', {height: $(window).height()-$(".bootstrap-table").offset().top-150});
				} catch (e) {
				}
			}
	    })
		
		//清空事件
		$("#empty").click(function(){
			$("#search-form")[0].reset();
		})
		
		//模糊查询
		$("#ok").click(function(){
			//获得表单内容
			var params = jQuery("#search-form").serializeJson();
			$("#table").bootstrapTable("refresh", {query: params});
		});
		
		//导出  需求  导出 即全部导出
		$("#export").click(function(){
			//创建临时表单
			var $tempForm = $("<form style='display:none;'></form>");
			$("body").append($tempForm);
			$tempForm.attr("action", "<%=basePath%>rest/codemanager/metastand/excelexport");
			$tempForm.attr("method", "post");
			$tempForm.submit();
			$tempForm.remove();
		})
		
		//下载模板
		$("#downloadTemplete").click(function(){
			//创建临时表单
			var $tempForm = $("<form style='display:none;'></form>");
			$("body").append($tempForm);
			$tempForm.attr("action", "<%=basePath%>rest/codemanager/metastand/downloadTemplete");
			$tempForm.attr("method", "post");
			$tempForm.submit();
			$tempForm.remove();
		});
	  
	});

</script>